package com.freestyle.nettychat.chat;

/**
 * Created by rocklee on 2022/2/6 13:07
 */
public enum  ChatCommand {
  createRoom("create"),
  removeChatRoom("remove"),
  getOnLineUserList("onlineuser"),
  getOnLineChatRoom("onlineroom"),
  login("login"),
  logout("logout"),
  //client command
  enterRoom("enter"),
  sendFile("file"),
  fetchFile("fetch"),
  exit("exit"),
  help("help");
  private final String value;
  ChatCommand(String value) {
    this.value = value;
  }
  public String getValue(){
    return this.value;
  }
  public static ChatCommand fromValue(String value){
    for (ChatCommand i:values()){
      if (i.getValue().equals(value)){
        return i;
      }
    }
    return null;
  }

}
